<template>
	<view>
		<view class="topBox">
			<image class="bgImage" src="/static/image/guide/homeBg.png"></image>
			<image @click="showDraw = true" class="btnIcon" src="http://cdn.yic3.cn/lawyer/mp-xhs/home/icon4.png"
				mode="widthFix"></image>
			<view class="renwuBox">
				<image v-show="selectIndex == 1" src="https://cdn.yic3.cn/lawyer/images/ainv.png"
					mode="widthFix">
				</image>
				<image v-show="selectIndex == 2" src="https://cdn.yic3.cn/lawyer/images/ainan.png"
					mode="widthFix">
				</image>
				<view class="textBox">
					<p>Hi Welcome To</p>
					<p>法律智能助手</p>
				</view>
			</view>
		</view>
		<view class="box1" >
			我是你随身携带的私人法律助理
		</view>
		<view class="box2">
			<view class="" @click="goRoute('/packageA/pages/dialog/dialog')">
				<image v-if="free" src="https://cdn.yic3.cn/lawyer/mp-xhs/home/freeIcon.png" mode="widthFix"></image>
			</view>
			<view>
				<image @click="goRoute('/packageA/pages/contractReview/contractReview')"
					src="https://cdn.yic3.cn/lawyer/images/home2.png" mode="widthFix"></image>
				<image @click="goRoute('/packageA/pages/smartCompose/smartCompose')"
					src="https://cdn.yic3.cn/lawyer/images/home3.png" mode="widthFix"></image>
			</view>
		</view>
		<vipPopup></vipPopup>
		<u-overlay :show="showDraw" @click="showDraw = false">
			<view class="drawBox" @click.stop="">
				<view class="boxHead">
					<text>我的对话历史</text>
					<image @click="showDraw = false" src="http://cdn.yic3.cn/lawyer/mp-xhs/guide/closeIconWhite.png" mode="widthFix"></image>
				</view>
				<view class="recordList">
					<view class="" @click="goRoute('/packageA/pages/dialog/dialogRecord',{item:JSON.stringify(item)})" v-for="(item,index) in dialogRecord" :key="index">
						<p>{{item[1].sendText}}</p>
						<p>{{changeTime(item[0].createTime)}}</p>
					</view>
				</view>
			</view>
		</u-overlay>
	</view>
</template>
<script>
	import dateTime from '../../../packageA/pages/dialog/dateTime.js'
	import {
		mapState,
		mapActions
	} from 'vuex'
	export default {
		data() {
			return {
				selectIndex: 1,
				showDraw: false,
				dialogRecord:[],
				free:false
			};
		},
		onLoad() {
			let that = this
			this.free = uni.getStorageSync('config')['client.limited.exemption.enable']
			this.selectIndex = uni.getStorageSync('selectRenWu') || 1
			this.getUserInfo()
		},
		onShow() {
			this.dialogRecord = uni.getStorageSync('dialogRecord')
			console.log(this.dialogRecord)
		},
		methods: {
			...mapActions({
				getUserInfo: 'getUserInfo'
			}),
			changeTime(e){
				return dateTime.dateTime1(e)
			}
		}
	}
</script>

<style lang="scss" scoped>
	@import 'home.scss'
</style>
<style>
	page {
		background-color: #18171D;
	}
</style>